package com.hk.demo.player.grid;

import java.util.Arrays;
import java.util.List;

/**
 * @author: zhoug
 * @since: 2025-08-15
 */
public class GridMode {
    // 布局模式常量
    public static final int MODE_1X1 = 1;
    public static final int MODE_2X2 = 4;
    public static final int MODE_3X3 = 9;


    public static List<Integer> getModes() {
        return Arrays.asList(MODE_1X1, MODE_2X2, MODE_3X3);
    }

    public static String getModeName(int mode) {
        return switch (mode) {
            case MODE_2X2 -> "2x2";
            case MODE_3X3 -> "3x3";
            default -> "1x1";
        };
    }

    /**
     * 根据GridMode计算每页数据条数
     * @param mode GridMode
     * @return  每页数据条数
     */
    public static int getItemsPerPage(int mode) {
        return switch (mode) {
            case GridMode.MODE_2X2 -> 4;
            case GridMode.MODE_3X3 -> 9;
            default -> 1;
        };
    }


}
